home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / ocean / cacd_bin.000 / cacd_bin / bin / nspice < prev    next >
Encoding:
Text File  |  1994-05-06  |  1.3 KB  |  55 lines

  1. #!/bin/sh
  2. #
  3. # USAGE
  4. #        nspice [-x] cellname [cmdfile]
  5. # OPTIONS
  6. #        -x : only extract spicefile, do not run spice3
  7. # ARGUMENTS
  8. #        Cellname is the name of the circuit to be simulated.
  9. #        Cmdfile is the file containing sls commands. The default name of
  10. #        cmdfile is cellname.cmd
  11. # DESCRIPTION
  12. #        Nspice3 extracts a spice listing from the nelsis database. It then
  13. #        calls the preprocessor nspice_pp to replace symbolic net/terminal
  14. #        names with numerical node names as required by spice. If no -x option
  15. #        is given it then calls spice3 in batch mode, redirecting the results
  16. #        to the file cellname.ana. Finally, the numerical node names are
  17. #        replaced by their symbolic equivalents by nspice3_bs.
  18. #
  19. #
  20. # xsls: always use options -Shlmbf;
  21. #       the use of options -xy [ -z name ] is recommended 
  22. #
  23.  
  24. # exit immediately on error
  25. set -e
  26.  
  27. # spice3 in batch mode crashes on hp400 if DISPLAY is set...:
  28. # unset DISPLAY
  29.  
  30. extractonly=0
  31. if [ "X$1" = "X-x" ] ; then
  32.    extractonly=1 ; shift
  33. fi
  34. if [ $# -eq 1 ] ; then
  35.    cmd="$1.cmd"
  36. else 
  37.    cmd=$2
  38. fi
  39. xspice -hilmbf -xy $1
  40. nspice_pp $1 $cmd >> $1.spc
  41. if [ $extractonly = 1 ] ; then
  42.    exit 0
  43. fi
  44.  
  45. # execute spice3 in batch mode:
  46. spice3 < $1.spc > $1.ana
  47.  
  48. # perform back substitution:
  49. if nspice_bs $1
  50. then
  51.    exit 0
  52. else
  53.    exit 1
  54. fi
  55.